# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time        : 2021/4/17 14:17
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : Graph.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""


def get_edge(dict_graph: dict):
    """
    获得字典数据结构存储图的边集
    :param dict_graph: 字典数据结构存储的图
    :return: 边集列表
    """
    edge_ls = []
    for vertex in dict_graph:
        adj = dict_graph[vertex]
        for adj_vertex in adj:
            edge_ls.append((vertex, adj_vertex))
    return edge_ls


if __name__ == '__main__':
    graph = {'a': ['b'],
             'b': ['c'],
             'c': ['a', 'b']}
    print(get_edge(graph))
